/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dao;
import java.util.List;
import org.hibernate.Query;
import org.hibernate.Session;
import pojo.*;
import util.HibernateUtil;
/**
 *
 * @author DomKvic
 */
public class TypeOfAppleDAO {
    static public List<Typeofapple> getAll()
    {
        List<Typeofapple> list = null;
        Session session = HibernateUtil.getSessionFactory().openSession();
        session.beginTransaction();
        String hql = "FROM Typeofapple";
        Query query = session.createQuery(hql);
        list = query.list();
        session.close();
        return list;
    }
    
    public static Typeofapple getInfo(int idType) {
        Session session = util.HibernateUtil.getSessionFactory().openSession();
        session.beginTransaction();
        Typeofapple type= (Typeofapple) session.get(Typeofapple.class, idType);
        session.close();
        return  type; 
    }
}
